package com.example.demoshiyan01;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

import java.util.Arrays;

public class CommangLineRunner {
    @Bean
    public void run(ApplicationContext ctx){

            System.out.println("由spring boot注册的所有Bean:");
            String[] beanNames=ctx.getBeanDefinitionNames();
            Arrays.sort(beanNames);
            for(String beanName:beanNames) {
                System.out.println(beanName);
            }
    }
}
